package com.example.idlefish.MyAccount.contract

import android.app.*
import android.content.*
import android.util.Log
import androidx.activity.result.contract.*
import com.example.idlefish.MyAccount.activity.*
import com.example.idlefish.MyAccount.pojo.*
import java.io.*


class MeFollowContract: ActivityResultContract<Long, User?>() {
    override fun createIntent(context: Context, input: Long): Intent {
        return Intent(context, MeFollowActivity::class.java).apply {
            Log.i("MeFollowContract传去信息", input.toString())
            putExtra("id", input)
        }
    }

    override fun parseResult(resultCode: Int, intent: Intent?): User? {
        if(intent == null) {
            return null
        }
        val data = CommonUtil.getSerializable(intent, "addInfo", User::class.java)
        if(resultCode == Activity.RESULT_OK){
            return data
        }
        return null
    }
}
